<?php
/**
 * 话题分类
 */
//require_once dirname(dirname(__DIR__))."/common.php";
require_once dirname(__DIR__)."/login_filter.php";
use app\cls\tom\Response;
use app\cls\tom\SysResource;
use app\model\Topic;
$uuid=$Auth['uuid'];
//分类ID
$topic_id=$_REQUEST['topic_id'];
if(empty($topic_id)){
    Response::output(-1,"参数错误1");
}
//分页
$page = isset($_REQUEST["page"]) ? intval($_REQUEST["page"]) : 1;
$page = $page > 0 ? $page : 1;
$pageSize = 10;
//最小的id
//$small_topic_id = isset($_REQUEST["small_topic_id"]) ? intval($_REQUEST["small_topic_id"]) : "";
//实例化数据库
$db = SysResource::getDB(false);
$Topic = new Topic($db);

//根据话题id，查询话题分类视频
$topic_class=$Topic->topic_class($page,$pageSize,$topic_id);
if(!empty($topic_class)){
    foreach($topic_class as $k=>&$v){
        if($v['uuid']==$uuid){
            $v['is_user']=1;
        }else{
            $v['is_user']=0;
        }
    }
}
Response::output(0,"查询成功",$topic_class);
